package com.leilei.MyObject;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by yvdedu.com on 2016/10/18.
 */
@Entity
public class ArticleInfo {
    @JsonIgnore
    @Id
    @GenericGenerator(name = "getArticleId",strategy = "foreign",parameters = {
            @Parameter(name = "property",value = "article")
    })
    @GeneratedValue(generator = "getArticleId")
    private int id;
    private int role;
    @Temporal(TemporalType.TIMESTAMP)
    @Column(nullable = true)
    private Date topTime;
    @JsonIgnore
    @OneToOne
    @JoinColumn(nullable = false)
    private  Article article;

    public ArticleInfo() {
    }

    public ArticleInfo(int role, Date topTime, Article article) {
        this.role = role;
        this.topTime = topTime;
        this.article = article;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getRole() {
        return role;
    }

    public void setRole(int role) {
        this.role = role;
    }

    public Date getTopTime() {
        return topTime;
    }

    public void setTopTime(Date topTime) {
        this.topTime = topTime;
    }

    public Article getArticle() {
        return article;
    }

    public void setArticle(Article article) {
        this.article = article;
    }
}
